package com.okyai.cms.service.impl;

import java.util.List;
import com.okyai.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.okyai.cms.mapper.CmsHistoryLogMapper;
import com.okyai.cms.domain.CmsHistoryLog;
import com.okyai.cms.service.ICmsHistoryLogService;
import com.okyai.common.core.text.Convert;

/**
 * 文章浏览记录Service业务层处理
 * 
 * @author okyai
 * @date 2020-12-03
 */
@Service
public class CmsHistoryLogServiceImpl implements ICmsHistoryLogService 
{
    @Autowired
    private CmsHistoryLogMapper cmsHistoryLogMapper;

    /**
     * 查询文章浏览记录
     * 
     * @param id 文章浏览记录ID
     * @return 文章浏览记录
     */
    @Override
    public CmsHistoryLog selectCmsHistoryLogById(Long id)
    {
        return cmsHistoryLogMapper.selectCmsHistoryLogById(id);
    }

    /**
     * 查询文章浏览记录列表
     * 
     * @param cmsHistoryLog 文章浏览记录
     * @return 文章浏览记录
     */
    @Override
    public List<CmsHistoryLog> selectCmsHistoryLogList(CmsHistoryLog cmsHistoryLog)
    {
        return cmsHistoryLogMapper.selectCmsHistoryLogList(cmsHistoryLog);
    }

    /**
     * 新增文章浏览记录
     * 
     * @param cmsHistoryLog 文章浏览记录
     * @return 结果
     */
    @Override
    public int insertCmsHistoryLog(CmsHistoryLog cmsHistoryLog)
    {
        cmsHistoryLog.setCreateTime(DateUtils.getNowDate());
        return cmsHistoryLogMapper.insertCmsHistoryLog(cmsHistoryLog);
    }

    /**
     * 修改文章浏览记录
     * 
     * @param cmsHistoryLog 文章浏览记录
     * @return 结果
     */
    @Override
    public int updateCmsHistoryLog(CmsHistoryLog cmsHistoryLog)
    {
        cmsHistoryLog.setUpdateTime(DateUtils.getNowDate());
        return cmsHistoryLogMapper.updateCmsHistoryLog(cmsHistoryLog);
    }

    /**
     * 删除文章浏览记录对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteCmsHistoryLogByIds(String ids)
    {
        return cmsHistoryLogMapper.deleteCmsHistoryLogByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除文章浏览记录信息
     * 
     * @param id 文章浏览记录ID
     * @return 结果
     */
    @Override
    public int deleteCmsHistoryLogById(Long id)
    {
        return cmsHistoryLogMapper.deleteCmsHistoryLogById(id);
    }
}
